local kuanglianronglu = fk.CreateSkill {
  name = "kuanglianronglu",
  tags = { Skill.Limited },
}

Fk:loadTranslationTable{
  ["kuanglianronglu"] = "狂练熔炉",
  [":kuanglianronglu"] = "出牌阶段限一次，你可以弃置四张牌并选择一名角色，从该角色开始，所有其他角色依次受到你对其造成1点火焰伤害。",

  ["#kuanglianronglu"] = "狂练熔炉：选择一名角色，从该角色开始结算“狂练熔炉”！",
}

kuanglianronglu:addEffect("active", {
  anim_type = "offensive",
  prompt = "#kuanglianronglu",
  card_num = 4,
  target_num = 1,
  card_filter = Util.FalseFunc,
  can_use = function(self, player)
    return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
    and #player:getCardIds("h") > 3
  end,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select ~= player
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected < 4 and not player:prohibitDiscard(Fk:getCardById(to_select))
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local first = effect.tos[1]
    local targets = {first}
    local temp = first.next
    room:throwCard(effect.cards, self.name, player, player)
    while temp ~= first do
      if not temp.dead then
        table.insert(targets, temp)
      end
      temp = temp.next
    end
    table.removeOne(targets, player)
    for _, target in ipairs(targets) do
      if not target.dead then
          room:damage{
            from = player,
            to = target,
            damage = 1,
            damageType = fk.FireDamage,
            skillName = kuanglianronglu.name,
          }
      end
    end
  end
})

return kuanglianronglu
